<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="copyright" content="本页版权 www.zongheng.com 纵横中文网所有。All Rights Reserved"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="shortcut icon" href="https://static.zongheng.com/favicon.ico"/>
    <title>[[${title}]]小说_小说推荐_好看的完本免费小说推荐- 纵横中文网</title>
    <meta name="keywords" content="十月的夏天最新章节, 十月的夏天全文阅读, 是十月的小说"/>
    <meta name="description" content="《十月的夏天》是是十月在纵横中文网原创首发的武侠仙侠, 是十月的小说十月的夏天最新章节全文阅读,请随时关注更新最快的小说网站纵横中文网。"/>

    <link rel="stylesheet" type="text/css" th:href="@{/css/basic.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/store.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/book.min.css}"/>

    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}"/>
    <script type="text/javascript" th:src="@{/layui/layui.js}"></script>
    <script type="text/javascript" th:src="@{/js/jquery-1.9.1.js}"></script>

</head>
<body>
<div class="wrap">
    <div class="head">
        <div class="head-top clearfix">
            <div class="logo imgbox fl">
                <a th:href="@{/index}"><img th:src="@{/picture/logo.png}" alt="logo" src=""></a>
            </div>
            <form id="commSearch" name="searchForm" method="get" th:action="@{/search}">
                <div class="search-box fl" data-hook="searchSuggest">
                    <label>
                        <input class="search-text fl" name="fictionName" type="text"
                               placeholder="请输入书名"/>
                    </label>
                    <input type="submit" class="search-btn fr"/>
                </div>
            </form>
            <div class="right-wrap-login ud_userTox" style="right: 0">
                <div class="unlogin ud_unlogin clearfix">
                    <div th:if="${session.loginUser==null}" class="login fl"><a class="user_login layui-icon"
                                                                                th:href="@{/login}">&#xe66f;登录</a></div>
                    <div th:if="${session.loginUser==null}" class="regist fl"><a class="user_register layui-icon"
                                                                                 th:href="@{/signin}">&#xe672;注册</a>
                    </div>
                    <div th:if="${session.loginUser==null}" class="regist fl">
                        <a style="padding-left: 12px" class="layui-icon layui-icon-template-1 "
                           th:href="@{/author/index}">作家专区</a>
                    </div>
                    <div th:if="${session.loginUser!=null}" class="shelf">
                        <a class="user_login layui-icon" th:href="@{/personal}">&#xe66f;个人中心</a>
                        <a style="padding-left: 12px;" th:href="@{/shelf}" class="layui-icon"
                           target="_blank">&#xe705;书架</a>
                        <a style="padding-left: 12px" class="layui-icon layui-icon-template-1 "
                           th:href="@{/author/index}">作家专区</a>
                        <a style="padding-left: 12px;" class="layui-icon layui-icon-rmb" th:href="@{/recharge}">充值</a>
                        <a style="padding-left: 12px;" class="layui-icon" th:href="@{/logout}">&#x1006;注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="h20-blank"></div>
    <!-- 书封页start -->
    <div id="container" class="book-html-box clearfix">
        <!-- 书籍详细信息 -->
        <div class="book-top clearfix">
            <div class="book-main fl">
                <div class="book-detail clearfix">
                    <div class="book-img fl">
                        <em class=""></em>
                        <img th:src="${novel.imgSrc}" src="" th:alt="${novel.novelName}" width="200" height="264"
                             alt="">
                    </div>
                    <div class="book-info">

                        <input type="hidden" id="novelId" name="novelId" th:value="${novel.novelId}">
                        <input type="hidden" id="authorId" name="authorId" th:value="${novel.authorId}">

                        <div th:text="${novel.novelName}" class="book-name">
                        </div>
                        <div class="book-label">
                            <a href="" class="state" th:text="${novel.end==1?'已完结':'连载中'}"></a>
                            <a href="" class="label" th:text="${novel.category}"></a>
                        </div>
                        <div class="nums">
                            <span>推荐数 <i id="recommend-count" th:text="${novel.novelRecommend}"> </i> </span>
                            <span>总点击 <i id="click-count" th:text="${novel.novelClick}"></i> </span>
                            <span>总打赏 <i id="reward-count" th:text="${novel.rewardAmount}">0</i> </span>
                        </div>
                        <div class="book-dec Jbook-dec hide">
                            <p th:text="${novel.novelIntroduction}"><br>　</p>
                        </div>
                        <div class="btn-group">
                            <a class="btn read-btn"
                               th:href="'/chapter/read/'+${novel.novelId}+'/1'">开始阅读</a>
                            <a id="chapter-list" class="btn read-btn"
                               th:href="'/chapter/list/'+${novel.novelId}">章节目录</a>
                            <div th:if="${session.loginUser!=null}">
                                <br>
                                <br>
                                <form style="float: left" th:action="@{'/download/'+${novel.novelId}}" method="post">
                                    <input type="submit" class="btn store-btn no-stored" value="下载小说">
                                </form>
                                <button onclick="recommendNovel()" type="button" class="btn store-btn no-stored">推荐小说
                                </button>
                                <button onclick="rewardNovel()" type="button" class="btn store-btn no-stored">小说打赏
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="book-new-chapter">
                    <h4>最新章节</h4>
                    <div class="tit" th:if="${chapter!=null}">
                        <a th:href="'/chapter/read/'+${novel.novelId}+'/'+${chapter.novelOrder}"
                           th:text="${chapter.chapterName}"></a>
                    </div>
                </div>


                <!-- 章评盒 -->
                <div id="reader-chapterforum-wrap" class="chapter_forum">
                    <div class="chapter_forum_tit">
                        <h3 style="font-size: 15px;">书评</h3>
                        <hr>
                    </div>

                    <div class="chapter_thread_list">
                        <div class="chapter_thread">
                            <ul class="forums-list" id="JthreadList">

                            </ul>
                        </div>
                    </div>

                </div>
                <!-- /章评盒 -->

            </div>

            <div class="book-side fr">
                <div class="book-author">
                    <div class="au-head">
                        <a id="author-img-src" href=""><img th:src="@{/picture/book.png}" alt="是十月" width="60"
                                                            height="60"></a><em>本书作家</em>
                    </div>
                    <div class="au-name"><a th:text="${novel.authorName}" href="#" disabled></a>
                    </div>
                    <div class="au-words">
                        <span>作品总数<i id="novel-count">1</i></span>
                        <span>累计字数<i id="word-count">3.9万</i></span>
                        <span>本月更新<i id="update-count">1天</i></span>
                    </div>
                    <div class="au-says">
                        <h4>作者有话说</h4>

                        <div class="con empty">作者大大正在奋力码字哦~~~</div>

                    </div>
                </div>
                <div class="app-in clearfix">
                </div>
            </div>
        </div>
    </div>
    <div class="h20-blank"></div>
    <!-- 书封end -->
</div>
<script>

    //网页加载结束要执行的方法
    $(function () {
        //获取数据判断这个小说是否在书架内
        //获取novelId
        let novelId = $("#novelId").val();
        $.ajax({
            url: "/findShelf/" + novelId,
            method: "get",
            success: function (result) {
                if (result == true) {
                    //这本书在书架中
                    $("#chapter-list").after('<div class="btn store-btn stored">已在书架</div>');
                } else if (result == false) {
                    //这本书不在书架中
                    $("#chapter-list").after('<button onclick="addShelf()" type="button" id="add-shelf" class="btn store-btn no-stored">加入书架</button>');
                }
            }
        });
        getNovelInfo();
        setInterval(getNovelInfo, 10000);
        getAuthorInfo();
        getCommentInfo();
    })

    function rewardNovel() {
        layui.use('layer', function () {
            let layer = layui.layer;
            let url = '/novel/reward/' + $("#novelId").val();
            //打赏小说
            layer.open({
                type: 1,
                area: ['600px', '360px'],
                title: '打赏小说',
                shadeClose: true, //点击遮罩关闭
                content: '<div style="padding:20px;">\n' +
                    '    <form action="' + url + '" method="post">\n' +
                    '        <div class="bin_charge_choose_clear">\n' +
                    '            <div>\n' +
                    '                <label>\n' +
                    '                    <input value="100" name="cost" class="btn store-btn no-stored" type="radio">\n' +
                    '                    100书币\n' +
                    '                </label>\n' +
                    '            </div>\n' +
                    '\n' +
                    '            <div>\n' +
                    '                <label>\n' +
                    '                    <input value="500" name="cost" class="btn store-btn no-stored" type="radio">\n' +
                    '                    500书币\n' +
                    '                </label>\n' +
                    '            </div>\n' +
                    '\n' +
                    '            <div>\n' +
                    '                <label>\n' +
                    '                    <input value="1000" name="cost" class="btn store-btn no-stored" type="radio">\n' +
                    '                    1000书币\n' +
                    '                </label>\n' +
                    '            </div>\n' +
                    '\n' +
                    '            <div>\n' +
                    '                <label>\n' +
                    '                    <input value="5000" name="cost" class="btn store-btn no-stored" type="radio">\n' +
                    '                    5000书币\n' +
                    '                </label>\n' +
                    '            </div>\n' +
                    '\n' +
                    '            <div>\n' +
                    '                <label>\n' +
                    '                    <input value="10000" name="cost" class="btn store-btn no-stored" type="radio">\n' +
                    '                    10000书币\n' +
                    '                </label>\n' +
                    '            </div>\n' +
                    '\n' +
                    '        </div>\n' +
                    '\n' +
                    '        <br>\n' +
                    '\n' +
                    '        <p align="center">\n' +
                    '            <input type="submit" class="btn store-btn no-stored" value="打赏">\n' +
                    '        </p>\n' +
                    '    </form>\n' +
                    '</div>\n'
            });
        })
    }


    //添加书架成功后，修改标签内容
    function changeMode() {
        //删除原本的添加书架的标签
        $("#chapter-list").next().remove();
        //添加书籍已经添加的标签
        $("#chapter-list").after('<div class="btn store-btn stored">已在书架</div>');
    }

    //添加书架
    function addShelf() {
        //获取novelId
        let novelId = $("#novelId").val();
        $.ajax({
            url: "/addShelf/" + novelId,
            method: "post",
            success: function (result) {
                if (result == true) {
                    //添加书架成功，修改标签内容
                    changeMode();
                } else if (result == false) {
                    //添加书架失败
                    alert("网络繁忙，添加书架失败，请稍后再试!");
                } else {
                    //用户未登录，直接跳转到登录页面
                    window.location.href = "/login";
                }
            }
        })
    }

    //推荐小说确定框
    function recommendNovel() {
        let flag = confirm("确定要推荐这本小说吗?");
        if (!flag) {
            return;
        }
        //获取novelId
        let novelId = $("#novelId").val();
        //发起请求推荐小说
        $.ajax({
            url: "/novel/recommend/" + novelId,
            method: "post",
            success: function (result) {
                if (result == true) {
                    //推荐成功
                    alert("推荐成功!");
                } else {
                    //推荐失败
                    alert(result.message);
                }
            }
        })
    }

    //获取作品总数、累计字数、本月更新
    function getAuthorInfo() {
        //获取novelId
        let novelId = $("#novelId").val();
        let authorId = $("#authorId").val();
        //发起请求获取推荐
        $.ajax({
            url: "/author/param/" + novelId,
            data: {"authorId": authorId},
            dataType: "json",
            method: "post",
            success: function (result) {
                $("#novel-count").html(result.novelCount);
                $("#word-count").html(result.wordsCount);
                $("#update-count").html(result.monthUpdateCount);
                $("#author-img-src").html("<img src='" + result.imgSrc + "' width=\"60\" height=\"60\">");
            }
        })
    }

    //获取小说 各项参数
    function getNovelInfo() {
        //获取novelId
        let novelId = $("#novelId").val();
        //发起请求获取推荐
        $.ajax({
            url: "/novel/param/" + novelId,
            method: "post",
            success: function (result) {
                $("#recommend-count").html(result.novelRecommend);
                $("#click-count").html(result.novelClick);
                $("#reward-count").html(result.novelReward);
            }
        })
    }


    //获取章节评论内容
    function getCommentInfo() {
        //获取小说id
        let novelId = $("#novelId").val();
        //获取页号
        let pageNum = 1;
        //发起请求获取数据
        $.ajax({
            url: "/novel/comment/query/page?pageNum=" + pageNum + "&novelId=" + novelId,
            method: "get",
            success: function (result) {
                if (result.message) {
                    alert(result.message);
                } else {
                    let list = result.list;
                    let html = '';

                    $(list).each(function (index, comment) {
                        html += "<li data-forumsid=\"330345\" data-threadid=\"34868259\" data-nickname=\"" + comment.userName + "\"\n" +
                            " data-userid=\"49246974\">\n" +
                            " <div class=\"user-head\"><a\n" +
                            "         target=\"_blank\"><img\n" +
                            "src='" + comment.userImg + "' \n" +
                            "            alt=\"\" width=\"50\"\n" +
                            "            height=\"50\"><span><i\n" +
                            "            class=\"star star0\"></i></span></a></div>\n" +
                            "    <div class=\"for-rp-con\">\n" +
                            "        <div class=\"name\">" + comment.userName + "</div>\n" +
                            "        <div class=\"dec clearfix hide JdecAll \"><a class=\"aLabel\"\n" +
                            "               >" + comment.commentContent + "</a>\n" +
                            "        </div>\n" +
                            "        <div class=\"other\">\n" +
                            "            <div class=\"date fl\">" + comment.createdTime + "</div>\n" +
                            "        </div>\n" +
                            "    </div>\n" +
                            "</li>";
                    });

                    //把内容回填进去
                    if (pageNum > 1) {
                        $("#JthreadList:last-child").after().html(html);
                    } else if (pageNum == 1) {
                        $("#JthreadList").html(html);
                    }

                }
            }
        })
    }


</script>
</body>
</html>